{% extends "../master.html" %}

{% block header %}
    {% include "../header.html" %}
{% endblock %}

{% block page %}
    <h1>Yams</h1>
    <h3>{{ player.game.name }}</h3>
    <b>{{ player.name }}</b>
    <center>
    <div class="dice">
        <form class="form" action="/yams/roll" method="post">
        <div class="button">
            <table>
                <tr>
                    <td>
                        <img src="/static/img/yams/dice{{ dice1.value }}.gif" alt="{{ dice1.value }}" />
                    </td>
                    <td>
                        <img src="/static/img/yams/dice{{ dice2.value }}.gif" alt="{{ dice2.value }}" />
                    </td>
                    <td>
                        <img src="/static/img/yams/dice{{ dice3.value }}.gif" alt="{{ dice3.value }}" />
                    </td>
                    <td>
                        <img src="/static/img/yams/dice{{ dice4.value }}.gif" alt="{{ dice4.value }}" />
                    </td>
                    <td>
                        <img src="/static/img/yams/dice{{ dice5.value }}.gif" alt="{{ dice5.value }}" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <input name="dice1" type="checkbox" /> |
                        {{ dice1.turn }}
                    </td>
                    <td>
                        <input name="dice2" type="checkbox" /> |
                        {{ dice2.turn }}
                    </td>
                    <td>
                        <input name="dice3" type="checkbox" /> |
                        {{ dice3.turn }}
                    </td>
                    <td>
                        <input name="dice4" type="checkbox" /> |
                        {{ dice4.turn }}
                    </td>
                    <td>
                        <input name="dice5" type="checkbox" /> |
                        {{ dice5.turn }}
                    </td>
                </tr>
            </table>
            <br />
            {% if new_turn %}
                <input name="update" value="Roll" type="submit" />
            {% endif %}
            <input name="player_key" value="{{ player.key }}" type="hidden" />
            <input name="size_key" value="{{ size.key }}" type="hidden" />
            <input name="language_key" value="{{ language.key }}" type="hidden" />
        </div>
        </form>
    </div>
    </center>
    <br />
    <div class="score">
        <table>
            <tr>
                <th colspan="17">Game</th>
            </tr>
            <tr>
                <td></td>
                {% for s in score %}
                <th class="standard">
                    {{ s.name }}
                </th>
                {% endfor %}
            </tr>
            <tr>
                <th class="standard">
                    {{ player.name }}
                </th>
                {% for s in score%}
                <td>
                    <form class="form" action="/yams/score" method="post">
                    <div class="button">
                        {{ s.value }} <br />

                        {% if s.new %}
                            <input name="select" value="Select" type="submit" />
                        {% endif %}

                        {% if s.cancel %}
                            <input name="cancel" value="Cancel" type="submit" />
                        {% endif %}

                        <input name="score_name" value="{{ s.name }}" type="hidden" />
                        <input name="score_value" value="{{ s.value }}" type="hidden" />
                        <input name="player_key" value="{{ player.key }}" type="hidden" />
                        <input name="size_key" value="{{ size.key }}" type="hidden" />
                        <input name="language_key" value="{{ language.key }}" type="hidden" />
                    </div>
                    </form>
                </td>
                {% endfor %}
            </tr>
        </table>
        <br />
        <table>
            <tr>
                <th colspan="17">Scores</th>
            </tr>
            <tr>
                <td></td>
                {% for s in score %}
                <th class="standard">
                    {{ s.name }}
                </th>
                {% endfor %}
            </tr>
            {% for p in players %}
            <tr>
                <th class="standard">
                    {{ p.name }}
                </th>
                <td>
                    {% ifnotequal p.score.one -1 %}
                        {{ p.score.one }}
                    {% else %}
                        0
                    {% endifnotequal %}
                </td>
                <td>
                    {% ifnotequal p.score.two -1 %}
                        {{ p.score.two }}
                    {% else %}
                        0
                    {% endifnotequal %}
                </td>
                <td>
                    {% ifnotequal p.score.three -1 %}
                        {{ p.score.three }}
                    {% else %}
                        0
                    {% endifnotequal %}
                </td>
                <td>
                    {% ifnotequal p.score.four -1 %}
                        {{ p.score.four }}
                    {% else %}
                        0
                    {% endifnotequal %}
                </td>
                <td>
                    {% ifnotequal p.score.five -1 %}
                        {{ p.score.five }}
                    {% else %}
                        0
                    {% endifnotequal %}
                </td>
                <td>
                    {% ifnotequal p.score.six -1 %}
                        {{ p.score.six }}
                    {% else %}
                        0
                    {% endifnotequal %}
                </td>
                <th class="total">
                    {% if p.score.total_one %}
                        {{ p.score.total_one }}
                    {% endif %}
                </th>
                <td>
                    {% ifnotequal p.score.three_of_kind -1 %}
                        {{ p.score.three_of_kind }}
                    {% else %}
                        0
                    {% endifnotequal %}
                </td>
                <td>
                    {% ifnotequal p.score.four_of_kind -1 %}
                        {{ p.score.four_of_kind }}
                    {% else %}
                        0
                    {% endifnotequal %}
                </td>
                <td>
                    {% ifnotequal p.score.full -1 %}
                        {{ p.score.full }}
                    {% else %}
                        0
                    {% endifnotequal %}
                </td>
                <td>
                    {% ifnotequal p.score.small_suite -1 %}
                        {{ p.score.small_suite }}
                    {% else %}
                        0
                    {% endifnotequal %}
                </td>
                <td>
                    {% ifnotequal p.score.big_suite -1 %}
                        {{ p.score.big_suite }}
                    {% else %}
                        0
                    {% endifnotequal %}
                </td>
                <td>
                    {% ifnotequal p.score.lucky -1 %}
                        {{ p.score.lucky }}
                    {% else %}
                        0
                    {% endifnotequal %}
                </td>
                <td>
                    {% ifnotequal p.score.yams -1 %}
                        {{ p.score.yams }}
                    {% else %}
                        0
                    {% endifnotequal %}
                </td>
                <th class="total">
                    {% if p.score.total_two %}
                        {{ p.score.total_two }}
                    {% endif %}
                </th>
                <th class="total-all">
                    {% if p.score.total_all %}
                        {{ p.score.total_all }}
                    {% endif %}
                </th>
            </tr>
            {% endfor %}
        </table>
    </div>
    <div class="simple-link">
        <a href="/yams?language={{ language.locale_id }}&amp;size={{ size.width }}">Back</a>
    </div>
{% endblock %}

{% block footer %}
    {% include "../footer.html" %}
{% endblock %}
